<template>
  <div class="content">
    <!-- 搜索框区域 -->
      <common-header ></common-header>
    <searchBox ></searchBox>
    <miaoshaPage ></miaoshaPage>
    <common-footer></common-footer>

   
  </div>
</template>

<script>
import commonHeader from "@/components/commonHeader"
import commonFooter from "@/components/commonFooter"

import searchBox from "./components/searchBox";
import miaoshaPage from "./components/miaoshaPage"; // 引入秒杀组件
import { dtlogin } from "@/api/login"
import { mapState, mapActions } from 'vuex';
import { settoken,gettoken } from '@/utils/auth'

export default {
  name: "pagesContent",
  components: { searchBox,miaoshaPage,commonHeader,commonFooter},

  data() {
    return {

    };
  },
  computed: {
    ...mapState(['user']),
    
  },
  created() {
    
    console.log(this.user)
    var times=localStorage.getItem("times1")
    if(times){
      this.times=times
      this.getnumtimer()
    }
    
  },
  beforeDestroy() {
    if(this.timer&&this.times>0){
      localStorage.setItem("times1",this.times)
      clearInterval(this.timer)
    }else{
      localStorage.removeItem("times1")
      clearInterval(this.timer)
    }
   
  },
  methods: {
    getuserInfo(obj){
      // console.log(obj)
      if(!obj.token){
        return 
      }
      settoken(obj.token)
      var token =obj.token.replace('ext-', "")
      dtlogin(token).then(res=>{
        // console.log(res)
        sessionStorage.setItem("userInfo",JSON.stringify(res.data))
      })
    },
    
    ...mapActions(['openLoginDialog','closeLoginDialog','changeCustomerId']),
    
    
    
    
  },
  
};
</script>
<style scoped lang="scss">
.content{
  padding-bottom: 45px;
  background: #fff;
  
}
</style>
